package cn.itsource.zuul1020.controller;


import cn.itsource.basic.aop.LogAop;
import cn.itsource.basic.domain.JSONResult;
import cn.itsource.domain.login.LoginInfo;
import cn.itsource.zuul1020.service.LoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginInfoController {
    @Autowired
    LoginInfoService loginInfoService;

    @LogAop
    @PostMapping("/{accountType}/login")
    public JSONResult login(@RequestBody LoginInfo loginInfo, @PathVariable(value = "accountType") String accountType) {
        if ("tenant".equals(accountType) || "platform".equals(accountType) || "customer".equals(accountType)) {

            return loginInfoService.login(loginInfo);
        }
        throw new RuntimeException("非法登录");
    }
}
